package com.stars.easyms.base.util;

/**
 * <p>className: BeanPropertyUtil</p>
 * <p>description: BeanProperty工具类</p>
 *
 * @author guoguifang
 * @date 2019-12-23 13:48
 * @since 1.4.2
 */
public final class BeanPropertyUtil {

    public static String toDashedForm(String name) {
        StringBuilder result = new StringBuilder();
        for (char ch : name.replace("_", "-").toCharArray()) {
            if (Character.isUpperCase(ch) && result.length() > 0
                    && result.charAt(result.length() - 1) != '-') {
                result.append("-");
            }
            result.append(Character.toLowerCase(ch));
        }
        return result.toString();
    }

    private BeanPropertyUtil() {
    }
}